/*
 * Copyright (c) 2024. hallele, Inc All rights reserved.
 */

package cn.hallele.ms.portalcenter.model.repository;

import cn.hallele.mc.sdk.portalcenter.common.enums.MenuTypeEnum;
import cn.hallele.ms.portalcenter.model.entity.MenuEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.Collection;
import java.util.List;

/**
 * MenuRepository
 *
 * @author anle5
 * @since 2024/5/31 0:11
 */
public interface MenuRepository extends JpaRepository<MenuEntity, Long>, JpaSpecificationExecutor<MenuEntity> {
    /**
     * 通过id查询菜单
     *
     * @param ids id集合
     * @return 菜单结果
     */
    List<MenuEntity> findByIdIn(Collection<Long> ids);

    /**
     * 通过id和Type查询菜单
     *
     * @param ids   id集合
     * @param types 菜单类型
     * @return 菜单结果
     */
    List<MenuEntity> findByIdInAndTypeIn(Collection<Long> ids, List<MenuTypeEnum> types);
}
